import request from '@/utils/request';


export async function query({...resetParams}) {
  return request(`/concentrators`,{
    method:'GET',
    params:{
      ...resetParams,
      order_direction:'desc'
    }
  });
}


export async function remove({id}) {
  return request(`/concentrators/${id}`, {
    method: 'DELETE',
  });
}
export async function removeImei({id}) {
  return request(`/concentrators/${id}/imei`, {
    method: 'DELETE',
  });
}


export async function add(restParams) {
  return request(`/concentrators`, {
    method: 'POST',
    data: {
      ...restParams,
    },
  });
}
export async function addValue1(restParams) {
  return request(`/mechanical_meter_data`, {
    method: 'POST',
    data: {

      company_id:restParams.company_id,
      communication_type:1,
      values:restParams.metersArr,
    },
  });
}


export async function addValue(restParams) {
  return request(`/mechanical_meter_data`, {
    method: 'POST',
    data: {
        communication_type:2,
      values:restParams,
    },
  });
}


export async function edit({id,...restParams}) {
  return request(`/concentrators/${id}`, {
    method: 'PUT',
    data: {
      ...restParams,
    },
  });
}
export async function addImei({id,...restParams}) {
  return request(`/concentrators/${id}/imei`, {
    method: 'POST',
    data: {
      ...restParams,
    },
  });
}
export async function update({id,...restParams}) {
  return request(`/concentrators/${id}/firmware`, {
    method: 'POST',
    data: {
      ...restParams,
    },
  });
}
export async function config({id,...restParams}) {
  return request(`/concentrators/${id}/config`, {
    method: 'PUT',
    data: {
      ...restParams,
    },
  });
}
